<!DOCTYPE html>
<html lang="en">
<head th:insert="/admin/common/head::css"></head>
<body>
<div th:insert="/admin/common/header::header" ></div>
<!--  main  -->
<div class="container-fluid">
    <div class="row-fluid">
        <div th:insert="/admin/common/side::side" ></div>
        <!-- content  内容页面的代码放这里 -->
        <div class="block">
            <div class="block-content collapse in">
                <div class="span12">
                    <form class="form-horizontal" method="post">
                        <fieldset>
                            <legend>活动信息修改</legend>

                            <div class="control-group" th:if="${app != null}">
                                <label class="control-label">报名序号</label>
                                <div class="controls">
                                    <input readonly="readonly" required type="text" class="input-xlarge datepicker" id="id" name="id" th:value="${app!=null?app.id:''}">
                                </div>
                            </div>

                            <div class="control-group">
                                <label class="control-label" >活动名称</label>
                                <div class="controls">
                                    <input readonly="readonly" required type="text" class="input-xlarge datepicker" id="name" name="name" th:value="${app!=null?app.active.name:''}">
                                </div>
                            </div>

                            <div class="control-group">
                                <label class="control-label" >活动类型</label>
                                <div class="controls">
                                    <select readonly="readonly" th:value="${app != null?app.active.tid:''}" name="tid" id="tid" class="form-control1">
                                        <option th:selected="${app.active != null ? app.active.tid == type.id: ''}" th:each="type:${types}" th:value="${type.id}" th:text="${type.name}"></option>
                                    </select>
                                </div>
                            </div>

                            <div class="control-group">
                                <label class="control-label" >活动地址</label>
                                <div class="controls">
                                    <input readonly="readonly" required type="text" class="input-xlarge datepicker" id="address" name="address" th:value="${app.active!=null?app.active.address:''}">
                                </div>
                            </div>

                            <div class="control-group">
                                <label class="control-label" >活动时间</label>
                                <div class="controls">
                                    <input readonly="readonly" required type="date" class="input-xlarge datepicker" id="time" name="time" th:value="${app.active!=null?#dates.format(app.active.time, 'yyyy-MM-dd'):''}">
                                </div>
                            </div>

                            <div class="control-group">
                                <label class="control-label" >活动内容</label>
                                <div class="controls">
                                    <input readonly="readonly" required type="text" class="input-xlarge datepicker" id="content" name="content" th:value="${app.active!=null?app.active.content:''}">
                                </div>
                            </div>

                            <div class="control-group">
                                <label class="control-label" >报名时间</label>
                                <div class="controls">
                                    <input readonly="readonly" required type="text" class="input-xlarge datepicker" id="time" name="time" th:value="${#dates.format(app.time)}">
                                </div>
                            </div>

                            <div class="control-group">
                                <label class="control-label" >报名人</label>
                                <div class="controls">
                                    <input readonly="readonly" required type="text" class="input-xlarge datepicker" id="time" name="time" th:value="${app.user.username}">
                                </div>
                            </div>



                            <div class="control-group" th:if="${app.active != null}">
                                <label class="control-label" >发布人</label>
                                <div class="controls">
                                    <input readonly="readonly" required type="text" class="input-xlarge datepicker" th:value="${app.active!=null?app.active.user.username:''}">
                                </div>
                            </div>

                            <HR align=center width=300 color=#987cb9 SIZE=1>

                            <div class="control-group" >
                                <label class="control-label" >报名说明</label>
                                <div class="controls">
                                    <textarea rows="10" cols="50" name="comment" readonly="readonly">
                                       [[ ${app!=null?app.comment:''} ]]
                                    </textarea>
                                </div>
                            </div>

                            <div class="control-group" >
                                <label class="control-label" >审批回复</label>
                                <div class="controls">
                                    <textarea id="reply" rows="10" cols="50" name="reply" th:readonly="${app.index != 0 ? 'readonly':''}">
                                       [[ ${app!=null?app.reply:''} ]]
                                    </textarea>
                                </div>
                            </div>


                            <div class="form-actions">
                                <button th:if="${app.index==0}" type="button" class="btn btn-success" onclick="success()">审批通过</button>
                                <button th:if="${app.index==0}" type="button" class="btn btn-danger" onclick="fail()">审批驳回</button>
                                <a type="button" class="btn btn-warning" th:href="@{/admin/app/page}">返回</a>
                            </div>
                        </fieldset>
                    </form>

                </div>
            </div>
        </div>
        <!-- content -->
    </div>
</div>
<!--  main  -->

</body>
<div th:insert="/admin/common/footer::js" ></div>
<script type="text/javascript">

    document.getElementById("app").className = 'active'

    function success(){
        var value = document.getElementById("reply").value;
        console.log(value)
        window.location="http://localhost:8080/resource/admin/application/reply/success?id="+[[ ${app.id} ]]+"&reply="+value
    }

    function fail(){
        var value = document.getElementById("reply").value;
        console.log(value)
        window.location="http://localhost:8080/resource/admin/application/reply/fail?id="+[[ ${app.id} ]]+"&reply="+value
    }
</script>
</html>